package com.snail.starter.iam.initializing.properties;

import com.snail.starter.db.enums.EnableOrDisEnableEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: snail framework
 * @Date: 2023/3/8 下午4:08
 * @Version: 1.0.0
 */
@Data
@ToString
@Configuration
@EqualsAndHashCode(callSuper = true)
@ConfigurationProperties(prefix = "iam-menu")
public class MenuYaml extends ArrayList<MenuYaml.AppNode> {

    @Data
    @ToString
    public static class AppNode {

        private String name;

        private String appKey;

        private Integer userType;

        private Integer status;

        private List<MenuNode> menus;

    }

    @Data
    @ToString
    public static class MenuNode {

        private String name;

        private String path;

        /**
         * 1:菜单,2:功能
         */
        private Integer type;

        private Integer status = EnableOrDisEnableEnum.ENABLE.getValue();

        private Integer orderBy;

        private String icon = "default";

        private List<MenuNode> children;

    }

}